<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Document</title>
	</head>
	<body>
		<script>
			var msg = 'hello world'
			// 属性
			// console.log(msg.length)

			// 访问字符串中某个位置的字符
			// console.log(msg[20], msg[3])
			// console.log(msg.charAt(20), msg.charAt(3))

			// 字符串遍历
			// 普通for循环
			/* for (var i = 0; i < msg.length; i++) {
				console.log(msg[i], msg.charAt(i))
			} */

			// for of
			for (const ch of msg) {
				console.log(ch)
			}
		</script>
	</body>
</html>
